package sleuthkit.gui.actionlistener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultListModel;
import javax.swing.JList;

import org.apache.log4j.Logger;

import sleuthkit.util.StaticHelper;

public class RemoveEvidenceActionListener implements ActionListener {
	private Logger log = Logger.getLogger(RemoveEvidenceActionListener.class);
	private DefaultListModel addEvidenceDefaultListModel;
	private JList addEvidenceJList;
	
	public RemoveEvidenceActionListener(JList addEvidenceJList) {
		StaticHelper.configLogger();
		this.addEvidenceJList=addEvidenceJList;
		this.addEvidenceDefaultListModel = (DefaultListModel) addEvidenceJList.getModel();
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		 Object[] selectedItems = addEvidenceJList.getSelectedValues();
		 log.debug("getting the marked objeckts in the list panel.");
		 for (int i = 0; i < selectedItems.length; i++) {
			 log.debug("removing the this object " + selectedItems[i]);
			 addEvidenceDefaultListModel.removeElement(selectedItems[i]);
		 }
		
	}

}
